% \documentclass[a5paper]{report}
% \usepackage[margin=40pt]{geometry}
% \documentclass{report}
\documentclass{book}

\usepackage[paperwidth=5.7in, paperheight=8.55in, margin=1.25cm]{geometry}
\setlength{\footskip}{\dimexpr\footskip-.3cm\relax}

\usepackage{hyperref}
\usepackage{fontspec}
\usepackage{microtype}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{graphicx} 
\usepackage{wrapfig}
\usepackage{enumitem}
\usepackage{anyfontsize}
\usepackage{amsmath,amssymb}
\usepackage{tikz,tikz-layers}
\usetikzlibrary{calc,positioning,fit}

% strenghts and weakness colors
\definecolor{mygreen}{HTML}{edf7ec}
\definecolor{myred}{HTML}{fbecec}

% chapters colors
\definecolor{cyanlight}{HTML}{d3f9ff}
\definecolor{purplelight}{HTML}{b7a1d0}
\definecolor{orangelight}{HTML}{ffecc6}
\definecolor{corallight}{HTML}{FFDEDE}
\definecolor{mintlight}{HTML}{CAFFC4}

\definecolor{cyanhard}{HTML}{9CF2FF}
\definecolor{purplehard}{HTML}{A97ADE}
\definecolor{orangehard}{HTML}{FFD689}
\definecolor{coralhard}{HTML}{FFA5A5}
\definecolor{minthard}{HTML}{A1FF98}

% formula colors
\definecolor{nmlpurple}{HTML}{3B0280}
\definecolor{nmlcyan}{HTML}{00C8E5}
\definecolor{nmlred}{HTML}{DD4040}
\definecolor{nmlgreen}{HTML}{4EB046}
\definecolor{nmlyellow}{HTML}{E1BC29}



\setsansfont{Lato}[
    Path=./fonts/LatoFont/,
    % Scale=0.9,
    Extension = .ttf,
    UprightFont=*-Regular,
    BoldFont=*-Bold,
    ItalicFont=*-Italic,
    BoldItalicFont=*-BoldItalic
    ]

\setmainfont{Rubik}[
    Path=./fonts/RubikFont/,
    % Scale=0.9,
    Extension = .ttf,
    UprightFont=*-Regular,
    BoldFont=*-SemiBold,
    ItalicFont=*-Italic,
    BoldItalicFont=*-BoldItalic
    ]

\setmonofont{PlayfairDisplay}[
    Path=./fonts/PlayFairFont/,
    % Scale=0.85,
    Extension = .ttf,
    UprightFont=*-Regular,
    BoldFont=*-Bold,
    ItalicFont=*-Italic,
    BoldItalicFont=*-BoldItalic
    ]

%============================================================================
\usepackage{fancyhdr}

% Redefine \section to center the title without number
\makeatletter
\renewcommand\section{\@startsection{section}{1}{\z@}%
  {-3.5ex \@plus -1ex \@minus -.2ex}%
  {0.3ex \@plus.2ex}%
  {\Large\bfseries\centering}}
\makeatother

% Redefine \subsection to center the title without number
\makeatletter
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
  {-0.25ex\@plus -1ex \@minus -.2ex}%
  {1.5ex \@plus .2ex}%
  {\large\centering}}
\makeatother

% Remove visible section numbering but keep it in the .aux file for references
\setcounter{secnumdepth}{0}

% Define commands to store chapter, section title and number
\newcommand{\chaptertitle}{}
\newcommand{\sectiontitle}{}

% New command for chapters
\renewcommand{\chapter}[1]{%
    \refstepcounter{chapter}% Increment the chapter counter
    \clearpage
    \thispagestyle{empty}
    \vspace*{\fill}
    {\centering\huge\bfseries #1\par}
    \vspace*{\fill}
    \clearpage
    \renewcommand{\chaptertitle}{#1}%
}

% Redefine \section to update the mark and store the title
\let\oldsection\section
\renewcommand{\section}[1]{%
    \refstepcounter{section}% Increment the section counter
    \oldsection{#1}%
    \markboth{#1}{#1}% Store only title in both marks
    \renewcommand{\sectiontitle}{#1}% Store the title for use in the style
}

\fancypagestyle{regressionstyle}{
    \fancyhf{} % Clear all header and footer fields
    \fancyfoot[L]{\color{black!40}Daily metrics at nannyml.com/metrics} % Bottom left
    \fancyfoot[R]{\thesection\ \chaptertitle: \sectiontitle} % Bottom right, includes chapter.section number, chapter title, and section title
    \renewcommand{\headrulewidth}{0pt} % Remove header line
    \renewcommand{\footrulewidth}{0pt} % Remove footer line if undesired
    \tikz[overlay,remember picture]
    {
    \node[inner sep=0pt,outer sep=0pt,minimum width=.7cm, minimum height=\paperheight, anchor=north west, fill=cyanlight] (a) at (current page.north west) {};
    \node[anchor=east, rotate=90, xshift=-.5cm] at (a.north) 
    {
    \chaptertitle\ -- \sectiontitle % Chapter and section title here
    }; 
    }
}


\fancypagestyle{classificationstyle}{
    \fancyhf{} % Clear all header and footer fields
    \fancyfoot[L]{\color{black!40}Daily metrics at nannyml.com/metrics} % Bottom left
    \fancyfoot[R]{\thesection\ \chaptertitle: \sectiontitle} % Bottom right, includes chapter.section number, chapter title, and section title
    \renewcommand{\headrulewidth}{0pt} % Remove header line
    % \renewcommand{\fchapters colorsootrulewidth}{0pt} % Remove footer line if undesired
    \tikz[overlay,remember picture]
    {
    \node[inner sep=0pt,outer sep=0pt,minimum width=.7cm, minimum height=\paperheight, anchor=north west, fill=purplelight] (a) at (current page.north west) {};
    \node[anchor=east, rotate=90, xshift=-.5cm] at (a.north) 
    {
    \chaptertitle\ -- \sectiontitle % Chapter and section title here
    }; 
    }
}

\fancypagestyle{clusteringstyle}{
    \fancyhf{} % Clear all header and footer fields
    \fancyfoot[L]{\color{black!40}Daily metrics at nannyml.com/metrics} % Bottom left
    \fancyfoot[R]{\thesection\ \chaptertitle: \sectiontitle} % Bottom right, includes chapter.section number, chapter title, and section title
    \renewcommand{\headrulewidth}{0pt} % Remove header line
    % \renewcommand{\fchapters colorsootrulewidth}{0pt} % Remove footer line if undesired
    \tikz[overlay,remember picture]
    {
    \node[inner sep=0pt,outer sep=0pt,minimum width=.7cm, minimum height=\paperheight, anchor=north west, fill=orangelight] (a) at (current page.north west) {};
    \node[anchor=east, rotate=90, xshift=-.5cm] at (a.north) 
    {
    \chaptertitle\ -- \sectiontitle % Chapter and section title here
    }; 
    }
}

\fancypagestyle{rankingstyle}{
    \fancyhf{} % Clear all header and footer fields
    \fancyfoot[L]{\color{black!40}Daily metrics at nannyml.com/metrics} % Bottom left
    \fancyfoot[R]{\thesection\ \chaptertitle: \sectiontitle} % Bottom right, includes chapter.section number, chapter title, and section title
    \renewcommand{\headrulewidth}{0pt} % Remove header line
    % \renewcommand{\fchapters colorsootrulewidth}{0pt} % Remove footer line if undesired
    \tikz[overlay,remember picture]
    {
    \node[inner sep=0pt,outer sep=0pt,minimum width=.7cm, minimum height=\paperheight, anchor=north west, fill=corallight] (a) at (current page.north west) {};
    \node[anchor=east, rotate=90, xshift=-.5cm] at (a.north) 
    {
    \chaptertitle\ -- \sectiontitle % Chapter and section title here
    }; 
    }
}

\fancypagestyle{cvstyle}{
    \fancyhf{} % Clear all header and footer fields
    \fancyfoot[L]{\color{black!40}Daily metrics at nannyml.com/metrics} % Bottom left
    \fancyfoot[R]{\thesection\ \chaptertitle: \sectiontitle} % Bottom right, includes chapter.section number, chapter title, and section title
    \renewcommand{\headrulewidth}{0pt} % Remove header line
    % \renewcommand{\fchapters colorsootrulewidth}{0pt} % Remove footer line if undesired
    \tikz[overlay,remember picture]
    {
    \node[inner sep=0pt,outer sep=0pt,minimum width=.7cm, minimum height=\paperheight, anchor=north west, fill=mintlight] (a) at (current page.north west) {};
    \node[anchor=east, rotate=90, xshift=-.5cm] at (a.north) 
    {
    \chaptertitle\ -- \sectiontitle % Chapter and section title here
    }; 
    }
}

\fancypagestyle{nlpstyle}{
    \fancyhf{} % Clear all header and footer fields
    \fancyfoot[L]{\color{black!40}Daily metrics at nannyml.com/metrics} % Bottom left
    \fancyfoot[R]{\thesection\ \chaptertitle: \sectiontitle} % Bottom right, includes chapter.section number, chapter title, and section title
    \renewcommand{\headrulewidth}{0pt} % Remove header line
    % \renewcommand{\fchapters colorsootrulewidth}{0pt} % Remove footer line if undesired
    \tikz[overlay,remember picture]
    {
    \node[inner sep=0pt,outer sep=0pt,minimum width=.7cm, minimum height=\paperheight, anchor=north west, fill=cyanhard] (a) at (current page.north west) {};
    \node[anchor=east, rotate=90, xshift=-.5cm] at (a.north) 
    {
    \chaptertitle\ -- \sectiontitle % Chapter and section title here
    }; 
    }
}

\fancypagestyle{genaistyle}{
    \fancyhf{} % Clear all header and footer fields
    \fancyfoot[L]{\color{black!40}Daily metrics at nannyml.com/metrics} % Bottom left
    \fancyfoot[R]{\thesection\ \chaptertitle: \sectiontitle} % Bottom right, includes chapter.section number, chapter title, and section title
    \renewcommand{\headrulewidth}{0pt} % Remove header line
    % \renewcommand{\fchapters colorsootrulewidth}{0pt} % Remove footer line if undesired
    \tikz[overlay,remember picture]
    {
    \node[inner sep=0pt,outer sep=0pt,minimum width=.7cm, minimum height=\paperheight, anchor=north west, fill=purplehard] (a) at (current page.north west) {};
    \node[anchor=east, rotate=90, xshift=-.5cm] at (a.north) 
    {
    \chaptertitle\ -- \sectiontitle % Chapter and section title here
    }; 
    }
}

\fancypagestyle{probabilisticstyle}{
    \fancyhf{} % Clear all header and footer fields
    \fancyfoot[L]{\color{black!40}Daily metrics at nannyml.com/metrics} % Bottom left
    \fancyfoot[R]{\thesection\ \chaptertitle: \sectiontitle} % Bottom right, includes chapter.section number, chapter title, and section title
    \renewcommand{\headrulewidth}{0pt} % Remove header line
    % \renewcommand{\fchapters colorsootrulewidth}{0pt} % Remove footer line if undesired
    \tikz[overlay,remember picture]
    {
    \node[inner sep=0pt,outer sep=0pt,minimum width=.7cm, minimum height=\paperheight, anchor=north west, fill=orangehard] (a) at (current page.north west) {};
    \node[anchor=east, rotate=90, xshift=-.5cm] at (a.north) 
    {
    \chaptertitle\ -- \sectiontitle % Chapter and section title here
    }; 
    }
}

\fancypagestyle{biasfairnesstyle}{
    \fancyhf{} % Clear all header and footer fields
    \fancyfoot[L]{\color{black!40}Daily metrics at nannyml.com/metrics} % Bottom left
    \fancyfoot[R]{\thesection\ \chaptertitle: \sectiontitle} % Bottom right, includes chapter.section number, chapter title, and section title
    \renewcommand{\headrulewidth}{0pt} % Remove header line
    % \renewcommand{\fchapters colorsootrulewidth}{0pt} % Remove footer line if undesired
    \tikz[overlay,remember picture]
    {
    \node[inner sep=0pt,outer sep=0pt,minimum width=.7cm, minimum height=\paperheight, anchor=north west, fill=coralhard] (a) at (current page.north west) {};
    \node[anchor=east, rotate=90, xshift=-.5cm] at (a.north) 
    {
    \chaptertitle\ -- \sectiontitle % Chapter and section title here
    }; 
    }
}

\fancypagestyle{businessstyle}{
    \fancyhf{} % Clear all header and footer fields
    \fancyfoot[L]{\color{black!40}Daily metrics at nannyml.com/metrics} % Bottom left
    \fancyfoot[R]{\thesection\ \chaptertitle: \sectiontitle} % Bottom right, includes chapter.section number, chapter title, and section title
    \renewcommand{\headrulewidth}{0pt} % Remove header line
    % \renewcommand{\fchapters colorsootrulewidth}{0pt} % Remove footer line if undesired
    \tikz[overlay,remember picture]
    {
    \node[inner sep=0pt,outer sep=0pt,minimum width=.7cm, minimum height=\paperheight, anchor=north west, fill=minthard] (a) at (current page.north west) {};
    \node[anchor=east, rotate=90, xshift=-.5cm] at (a.north) 
    {
    \chaptertitle\ -- \sectiontitle % Chapter and section title here
    }; 
    }
}

\fancypagestyle{customstyle}{
    \fancyhf{} % Clear all header and footer fields
    \fancyfoot[L]{\color{black!40}Daily metrics at nannyml.com/metrics} % Bottom left
    \fancyfoot[R]{\thesection\ \chaptertitle: \sectiontitle} % Bottom right, includes chapter.section number, chapter title, and section title
    \renewcommand{\headrulewidth}{0pt} % Remove header line
    \renewcommand{\footrulewidth}{0pt} % Remove footer line if undesired
}

%============================================================================



\setlength{\parindent}{0pt}
\setlength{\parskip}{8pt}


\newcommand{\coloredboxes}[2]{
\tikz[every node/.style={outer sep=0pt, inner sep=0pt, align=left}] {
\node[ minimum width=.5\textwidth, minimum height=1cm, label={[yshift=-7.5mm]above:\strut\textbf{Strength}}] (a) {
\\[.7cm]
\parbox{.45\textwidth}{
\begin{itemize}[left=0pt, label={\textcolor{teal!60!green!60}{$\bullet$}}]
    #1
\end{itemize}
}

};

\path let \p1 = (a.north), \p2 = (a.south) in
node[ minimum width=.5\textwidth, minimum height=\y1-\y2, 
label={[yshift=-7.5mm]above:\strut\textbf{Weakness}}, anchor=north west] (b) at (a.north east) {
\\[.7cm]
\parbox{.45\textwidth}{
\begin{itemize}[left=0pt, label={\textcolor{red!80!black!60}{$\bullet$}}]
    #2
\end{itemize}
}

};

\begin{scope}[on behind layer]
\fill[mygreen] (current bounding box.north)--($(current bounding box.north west)+(.4,0)$) to[bend right=45] ($(current bounding box.north west)+(0,-.4)$)--($(current bounding box.south west)+(0,.4)$) to[bend right=45] ($(current bounding box.south west)+(.4,0)$)--(current bounding box.south)--cycle;    
\end{scope}

\begin{scope}[on behind layer]
\fill[myred] (current bounding box.north)--($(current bounding box.north east)+(-.4,0)$) to[bend left=45] ($(current bounding box.north east)+(0,-.4)$)--($(current bounding box.south east)+(0,.4)$) to[bend left=45] ($(current bounding box.south east)+(-.4,0)$)--(current bounding box.south)--cycle;    
\end{scope}
}
}



\newcommand{\orangebox}[2]{
{\bigskip\tikz[]{
\node[outer sep=0pt, inner ysep=.4cm, minimum width=\textwidth, fill=orangelight, rounded corners=2mm, align=left, text width=\textwidth-1cm] {
\textit{\ttfamily #1}\\[2mm]
#2
};
}}
}



\begin{document}
\setcounter{tocdepth}{1}  % 1 includes chapters and sections 
\tableofcontents
\newpage 
\include{1-introduction}
\include{2-regression}
\include{3-classification}
\include{4-clustering}
\include{5-ranking}
\include{6-computer-vision}
\include{7-nlp}
\include{8-genai}
\include{9-probabilistic}
\include{10-bias-fairness}
\include{11-business}
\end{document}